/*
  学习目标: Router组件切换路由模式
*/

import React, { Component } from 'react';
// 👍通过as 将路由重命名为Router
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';
export default class App extends Component {
  render() {
    return (
      <Router>
        <Link to="/home">点我调到首页</Link>
        <br />
        <Link to="/my">点我调到我的</Link>
        <br />
        <Link to="/friend">点我调到朋友</Link>
        <div>
          <div className="my_home">
            <Route path="/home" component={Home}></Route>
          </div>
          <Route path="/my" component={MyMusic}></Route>
          <Route path="/friend" component={Friend}></Route>
        </div>
      </Router>
    );
  }
}

function Home() {
  return <h1>我是首页组件</h1>;
}

function MyMusic() {
  return <h1>我是我的音乐件</h1>;
}

function Friend() {
  return <h1>我是朋友组件</h1>;
}
